<template>
    <div class="container">
        <div class="opt-area-02">
            <div class="left-con">
                录入总数: <span>{{countData.fcnum}} 条</span>
<!--                提交记录: <span>{{countData.ytbnum}} 条</span> |-->
<!--                暂存:<span>{{countData.zcnum}} 条</span>-->
            </div>
            <div class="right-con55">
<!--                <div class="input-frame">-->
<!--                    <Select v-model="params.hot" placeholder="发热状态" @on-change="selectlist">-->
<!--                        <Option value="">全部</Option>-->
<!--                        <Option value="0">未发热</Option>-->
<!--                        <Option value="1">发热</Option>-->
<!--                    </Select>-->
<!--                </div>-->
                <div class="input-frame" style="width: 164px">
                    <Input type="text" @on-click="selectlist(1)" placeholder="请输入姓名" style="width: 164px" v-model="params.name"
                           icon="ios-search"/>
                </div>
                <div class="input-frame" style="width: 164px">
                    <Input type="text" @on-click="selectlist(1)" placeholder="请输入身份证号" style="width: 164px" v-model="params.card_no"
                           icon="ios-search"/>
                </div>
                <div class="input-frame" style="width: 164px">
                    <Input type="text" @on-click="selectlist(1)" placeholder="请输入联系方式" style="width: 164px" v-model="params.tel"
                          icon="ios-search"/>
                </div>
                <div class="input-frame" style="width: 164px">
                  <Select v-model="params.area1" placeholder="区/县" filterable @on-change="perChange(1)">
                    <Option v-for="obj in addressInfo.list1" :value="obj.company_code" :key="obj.id">{{obj.title}}</Option>
                  </Select>
                </div>
                <div class="input-frame" style="width: 164px">
                  <Select v-model="params.area2" placeholder="街道" filterable @on-change="perChange(2)">
                    <Option v-for="obj in addressInfo.list2" :value="obj.company_code" :key="obj.id">{{obj.title}}</Option>
                  </Select>
                </div>
                <div class="input-frame" style="width: 164px">
                  <Select v-model="params.area3" placeholder="社区" filterable>
                    <Option v-for="obj in addressInfo.list3" :value="obj.company_code" :key="obj.id">{{obj.title}}</Option>
                  </Select>
                </div>
                <Button type="info" size="small" @click="selectlist(1)" style="margin-top: 5px">搜索</Button>
            </div>
            <div class="right-con55">
                <div class="input-frame" style="width: 164px">
                  <DatePicker type="datetimerange" v-model="dateArr" placeholder="选择录入时间起止" style="width: 164px"></DatePicker>
                </div>
                <div class="input-frame" style="width: 164px">
                  <Select v-model="params.arrive_address_type" placeholder="来沈前经过地" filterable>
                    <Option v-for="obj in dictList" :value="obj.value" :key="obj.id">{{obj.label}}</Option>
                  </Select>
                </div>
                <div class="input-frame" style="width: 164px">
                  <Select v-model="params.isfollow" placeholder="密切接触人群" @on-change="selectlist" style="width: 164px">
                    <Option value="">全部</Option>
                    <Option value="0">否</Option>
                    <Option value="1">是</Option>
                    <Option value="2">按行动轨迹主动申请隔离人员</Option>
                  </Select>
                </div>
                <div class="input-frame" style="width: 164px" v-if="params.isfollow=='1'">
                  <Select v-model="params.follow_person" placeholder="密接相关人" filterable>
                    <Option v-for="obj in followPersonList" :value="obj.value" :key="obj.id">{{obj.label}}</Option>
                  </Select>
                </div>
                <div class="input-frame" style="width: 164px" v-if="params.isfollow=='1'">
                  <Select v-model="params.follow_level" placeholder="密接等级" @on-change="selectlist" style="width: 164px">
                    <Option value="">全部</Option>
                    <Option value="1">一级密接</Option>
                    <Option value="2">二级密接</Option>
                    <Option value="3">三级密接</Option>
                  </Select>
                </div>
                <!-- <div class="input-frame" style="width: 164px">
                  <Select v-model="params.illness_state" placeholder="人员状态" @on-change="selectlist" style="width: 164px">
                    <Option value="">全部</Option>
                    <Option value="1">疑似病例</Option>
                    <Option value="2">确诊病例</Option>
                    <Option value="3">死亡</Option>
                    <Option value="4">治愈</Option>
                    <Option value="5">正常</Option>
                  </Select>
                </div> -->
                <!-- <div class="input-frame" style="width: 164px">
                  <Select v-model="params.inout_state" placeholder="离沈/入沈" @on-change="selectlist" style="width: 164px">
                    <Option value="">全部</Option>
                    <Option value="1">入沈人员</Option>
                    <Option value="2">离沈人员</Option>
                  </Select>
                </div> -->
            </div>
            <div class="right-con55">
              <!-- <div class="input-frame" style="width: 164px">
                  <Select v-model="params.supervise_startlista" multiple placeholder="管控状态" filterable>
                    <Option v-for="obj in superviseDictList" :value="obj.value" :key="obj.id">{{obj.label}}</Option>
                  </Select>
                </div> -->
                <!-- <div class="input-frame" style="width: 164px" v-if="params.supervise_startlista.indexOf('1') !== -1">
                  <Select v-model="params.is_transfer" placeholder="居家隔离状态" filterable>
                    <Option v-for="obj in isTransferList" :value="obj.value" :key="obj.id">{{obj.label}}</Option>
                  </Select>
                </div> -->
                <div class="input-frame" style="width: 164px">
                  <Select v-model="params.supervise_start" placeholder="管控状态" filterable>
                    <Option v-for="obj in superviseDictList" :value="obj.value" :key="obj.id">{{obj.label}}</Option>
                  </Select>
                </div>
                <div class="input-frame" style="width: 164px">
                  <Select v-model="params.supervise_timeout" placeholder="预警状态">
                    <Option value="">全部</Option>
                    <Option value="0">正常</Option>
                    <Option value="1">预警</Option>
                  </Select>
                </div>
                <div class="input-frame" style="width: 164px" v-if="params.supervise_start == 1">
                  <Select v-model="params.is_transfer" placeholder="居家隔离状态" filterable>
                    <Option v-for="obj in isTransferList" :value="obj.value" :key="obj.id">{{obj.label}}</Option>
                  </Select>
                </div>
                <div class="input-frame" style="width: 164px">
                  <Select v-model="params.user_type" placeholder="数据来源" @on-change="selectlist" style="width: 164px">
                    <Option value="">全部</Option>
                    <Option value="1">社区</Option>
                    <Option value="2">农村</Option>
                  </Select>
                </div>
              <!-- <div class="input-frame" style="width: 164px">
                <Select v-model="params.province2" placeholder="来沈前出发地省" filterable @on-change="chaneProv(2)" style="width: 164px">
                  <Option v-for="obj in inoutCity.provinceList" :value="obj.name" :key="obj.code">{{obj.name}}</Option>
                </Select>
              </div>
              <div class="input-frame" style="width: 164px">
                <Select v-model="params.city2" placeholder="来沈前出发地市" filterable style="width: 164px">
                  <Option v-for="obj in inoutCity.city2" :value="obj.name" :key="obj.code">{{obj.name}}</Option>
                </Select>
              </div> -->
              <div class="input-frame" style="width: 164px">
                <DatePicker type="datetimerange" v-model="arriveDateArr" placeholder="选择来沈时间起止" style="width: 164px"></DatePicker>
              </div>
              <!-- <div class="input-frame" style="width: 164px">
                <Select v-model="params.state" placeholder="隔离状态" @on-change="selectlist" style="width: 164px">
                  <Option value="">全部</Option>
                  <Option value="1">在家留观</Option>
                  <Option value="2">集中留观</Option>
                </Select>
              </div> -->
              <div class="input-frame" style="width: 164px">
                <Input type="text" @on-click="selectlist(1)" placeholder="请输入id" v-model="params.id"
                       icon="ios-search"/>
              </div>
            </div>
            <div class="right-con55">
              <div class="input-frame" style="width: 164px">
                <Select v-model="params.nucleic_acid" placeholder="核酸检测" @on-change="selectlist" style="width: 164px">
                  <Option value="">全部</Option>
                  <Option value="0">未检测</Option>
                  <Option value="1">已检测</Option>
                </Select>
              </div>
              <div class="input-frame" style="width: 164px">
                <Select v-model="params.detection_1_result" placeholder="第一次检测结果" style="width: 164px">
                  <Option value="">全部</Option>
                  <Option value="1">阴性</Option>
                  <Option value="2">阳性</Option>
                  <Option value="3">待出结果</Option>
                  <Option value="4">未检测</Option>
                </Select>
              </div>
              <div class="input-frame" style="width: 164px">
                <Select v-model="params.detection_2_result" placeholder="第二次检测结果" style="width: 164px">
                  <Option value="">全部</Option>
                  <Option value="1">阴性</Option>
                  <Option value="2">阳性</Option>
                  <Option value="3">待出结果</Option>
                  <Option value="4">未检测</Option>
                </Select>
              </div>
              <!-- <div class="input-frame" style="width: 164px">
                <Select v-model="params.affirm_state" placeholder="是否确认" style="width: 164px">
                  <Option value="">全部</Option>
                  <Option value="0">未确认</Option>
                  <Option value="1">已确认</Option>
                </Select>
              </div> 暂时隐藏-->
              <!-- <div class="input-frame" style="width: 164px">
                <Select v-model="params.risk_groups" placeholder="是否为风险人群" style="width: 164px">
                  <Option value="">全部</Option>
                  <Option value="0">否</Option>
                  <Option value="1">是</Option>
                </Select>
              </div> -->
            </div>
            <!-- <div class="right-con55">
              <div class="input-frame" style="width: 164px">
                <Select v-model="params.isolation" placeholder="是否居家隔离" filterable @on-change="chaneProv(2)" style="width: 164px">
                  <Option value="">全部</Option>
                  <Option value="0">否</Option>
                  <Option value="1">是</Option>
                </Select>
              </div>
            </div> -->
        </div>
        <Table :loading="countData.loading" border :columns="columns2" :data="fcDataList" size="small" ref="table">
            <template slot-scope="{ row }" slot="nucleic_acid">
              <span v-if="row.nucleic_acid == '0'">未检测</span>
              <span v-if="row.nucleic_acid == '1'">已检测</span>
            </template>
            <template slot-scope="{ row }" slot="isolation">
              <span v-if="row.isolation == '0'">否</span>
              <span v-if="row.isolation == '1'">是</span>
            </template>
            <template slot-scope="{ row }" slot="illness_state">
              <span v-if="row.illness_state == '1'" style="color: red">疑似病例</span>
              <span v-if="row.illness_state == '2'" style="color: red">确诊病例</span>
              <span v-if="row.illness_state == '3'" style="color: red">死亡</span>
              <span v-if="row.illness_state == '4'" >治愈</span>
              <span v-if="row.illness_state == '5'" >正常</span>
            </template>
            <template slot-scope="{ row }" slot="inout_state">
              <span v-if="row.inout_state == '1'">来沈人员</span>
              <span v-if="row.inout_state == '2'">离沈人员</span>
            </template>
<!--            <template slot-scope="{ row }" slot="hot">-->
<!--              <span v-if="row.hot == '1'" style="color: red">发热</span>-->
<!--              <span v-else>未发热</span>-->
<!--            </template>-->
          <template slot-scope="{ row }" slot="referral">
            <span v-if="row.referral == '1'">已送诊</span>
            <span v-else style="color: red">未送诊</span>
          </template>
          <template slot-scope="{ row }" slot="state">
            <span v-if="row.state == '1'">在家留观</span>
            <span v-if="row.state == '2'">集中留观</span>
          </template>
          <template slot-scope="{ row }" slot="isfollow">
            <span v-if="row.isfollow == '1'" style="color: red">是</span>
            <span v-else>否</span>
          </template>
          <template slot-scope="{ row }" slot="supervise_timeout">
            <span v-if="row.supervise_timeout == '0'">正常</span>
            <span v-if="row.supervise_timeout == '1'" style="color: red">预警</span>
          </template>
          <template slot-scope="{ row }" slot="isaffirm_state">
            <span v-if="row.affirm_state == '0'" style="color: red">未确认</span>
            <span v-if="row.affirm_state == '1'">已确认</span>
          </template>
          <template slot-scope="{ row }" slot="detection_1_result">
            <span v-if="row.detection_1_result == '1'">阴性</span>
            <span v-if="row.detection_1_result == '2'" style="color: red">阳性</span>
            <span v-if="row.detection_1_result == '3'">待出结果</span>
            <span v-if="row.detection_1_result == '4'">未检测</span>
          </template>
          <template slot-scope="{ row }" slot="detection_2_result">
            <span v-if="row.detection_2_result == '1'">阴性</span>
            <span v-if="row.detection_2_result == '2'" style="color: red">阳性</span>
            <span v-if="row.detection_2_result == '3'">待出结果</span>
            <span v-if="row.detection_2_result == '4'">未检测</span>
          </template>
          <template slot-scope="{ row }" slot="follow_level">
            <span v-if="row.follow_level == '1'">一级密接</span>
            <span v-if="row.follow_level == '2'">二级密接</span>
            <span v-if="row.follow_level == '3'">三级密接</span>
          </template>
            <template slot="action" slot-scope="{ row }">
                <Row style="margin-bottom: 5px; margin-top: 2px">
                    <Button class="table-action-btn" type="info" size="small" @click="showdetail(row, 'info')">详情</Button>
                  <Button class="table-action-btn" type="success" size="small" @click="showdetail(row, 'edit', params.states)">编辑</Button>
                </Row>
            </template>
        </Table>
        <Row v-if="loadData == true">
          <Col class="demo-spin-col" span="8" offset="8">
            <Spin fix>
              <Icon type="ios-loading" size=18 class="demo-spin-icon-load"></Icon>
              <div>Loading</div>
            </Spin>
          </Col>
        </Row>
        <Row type="flex" justify="end" class="page_style">
          <Page :current="params.pageNo" :total="params.totalRecord" show-sizer :page-size="params.pageSize"
                show-total @on-change="pageAction" @on-page-size-change="pageSizeChange"/>
        </Row>
        <Modal v-model="modal1" title="发热情况" @on-ok="ok" @on-cancel="cancel">
            <RadioGroup v-model="hot">
              <Radio label="0">未发热</Radio>
              <Radio label="1">发热</Radio>
            </RadioGroup>
        </Modal>
        <Modal v-model="modal2" title="送诊情况" @on-ok="ok1" @on-cancel="cancel">
            <Row class="mb20">
              <RadioGroup v-model="referral">
                <Radio label="0">未送诊</Radio>
                <Radio label="1">送诊</Radio>
              </RadioGroup>
            </Row>
            <Row v-if="referral == '1'">
              <Input v-model="referral_address" placeholder="送诊地址" type="textarea" style="width: 300px"></Input>
            </Row>
        </Modal>
        <Modal v-model="modal4" title="离沈情况" @on-ok="ok2" @on-cancel="cancel">
          <Row class="mb20">
            <RadioGroup v-model="modalInfo1.isout_sheny">
              <Radio label="0">未离沈</Radio>
              <Radio label="1">离沈</Radio>
            </RadioGroup>
          </Row>
          <Row v-if="modalInfo1.isout_sheny == '1'">
            <Input v-model="modalInfo1.isout_sheny_remark" placeholder="离沈后轨迹" type="textarea" style="width: 300px"></Input>
          </Row>
        </Modal>
        <Modal v-model="modal3" title="选择迁出到社区" @on-ok="saveCompany()" @on-cancel="cancel">
            <Form label-position="right" :label-width="100">
              <Row>
                <Col span="5" class="ivu-form-item-label">迁入社区：</Col>
                <Col span="16" class="ivu-form-item-content">
                  <Select v-model="modalStr" filterable>
                    <Option v-for="company in company_list" :value="JSON.stringify(company)"
                            v-bind:key="company.key">{{company.sq_name }} {{company.name}}（{{company.code}}）</Option>
                  </Select>
                </Col>
              </Row>
            </Form>
        </Modal>
        <Modal v-model="supervisedayinfo.isshow" title="设置预警日期">
             <Table border :columns="columns3" :data="supervisedayinfo.data" size="small" ref="tablesupervisedayinfo">
                <template slot="day" slot-scope="{ row }">
                        <Input v-model="row.day" type="number"/>
                </template>
                <template slot="action" slot-scope="{ row }">
                    <Button class="table-action-btn" type="info" size="small" @click="updatesupervisedayinfo(row)">保存</Button>
                </template>
             </Table>
        </Modal>
    </div>
</template>

<script>
import { userUpList, updateuserinfo, delbyid, createOutApplu, findOutAllList, date0str, getDictList, findSupervisedayList, saveSuperviseday } from '@/api/yi-qing-fang-kong'
import { grid_downlist, getUserByMZList } from '@/api/eventlist'
import { getCityList } from '@/api/common'
import saveparams from '@/view/yi-qing-fang-kong/saveparams.vue'
export default {
  name: 'superior-list',
  data () {
    return {
      dictList: [],
      supervisedayinfo: {
        isshow: false,
        data: []
      },
      superviseDictList: [],
      followPersonList: [],
      isTransferList: [],
      dateArr: [],
      arriveDateArr: [],
      loadData: true,
      fcAllDataStr: '',
      modalInfo1: {
        isout_sheny: '',
        isout_sheny_remark: '',
        id: this.id
      },
      modal4: false,
      loading: false,
      fcAllDataList: [],
      modalStr: '',
      modalInfo: {
        in_company: '',
        user_id: '',
        out_company_name: '',
        in_company_name: ''
      },
      type: this.$route.query.type, // 列表类型
      addressInfo: { list1: [], list2: [], list3: [] },
      inoutCity: { provinceList: [], city1: [], city2: [] },
      company_list: [],
      id: '',
      hot: '',
      referral: '',
      referral_address: '',
      modal1: false,
      modal2: false,
      modal3: false,
      row: {},
      countData: { loading: false, fcnum: 0, ytbnum: 0, zcnum: 0 },
      params: { name: '', type: '', pageNo: 1, pageSize: 10, totalRecord: 0, state: '', area1: '', area2: '', area3: '', arrive_address_type: '', hot: '', isfollow: '', user_type: '', starttime: '', endtime: '', company_code: '', isout_sheny: '', originate_province: '', originate_city: '', arrivestarttime: '', arriveendtime: '', id: '', nucleic_acid: '', isolation: '', supervise_start: '', supervise_timeout: '', supervise_startlista: [] },
      columns2: [
        { title: 'ID', key: 'id', width: 150, align: 'center' },
        { title: '姓名', key: 'NAME', width: 100, align: 'center' },
        { title: '联系方式', key: 'tel', width: 120, align: 'center' },
        { title: '身份证号', key: 'card_no1', width: 160, align: 'center' },
        { title: '性别', key: 'sex', width: 80, align: 'center' },
        { title: '核酸检测', slot: 'nucleic_acid', width: 100, align: 'center' },
        { title: '第一次检测结果', slot: 'detection_1_result', width: 100, align: 'center' },
        { title: '第二次检测结果', slot: 'detection_2_result', width: 100, align: 'center' },
        // { title: '是否居家隔离', slot: 'isolation', width: 120, align: 'center' },
        // { title: '人员状态', slot: 'illness_state', width: 100, align: 'center' },
        // { title: '离沈状态', slot: 'inout_state', width: 100, align: 'center' },
        { title: '管控状态', key: 'supervise_start1', width: 100, align: 'center' },
        { title: '居家隔离状态', key: 'is_transfer', width: 100, align: 'center' },
        { title: '本次管控开始日期', key: 'supervise_time', width: 100, align: 'center' },
        { title: '集中隔离开始日期', key: 'olation_time', width: 100, align: 'center' },
        { title: '预警状态', slot: 'supervise_timeout', width: 100, align: 'center' },
        { title: '预警时间', key: 'supervise_day', width: 100, align: 'center' },
        // { title: '发热状态', slot: 'hot', width: 100, align: 'center' },
        // { title: '送诊状态', slot: 'referral', width: 100, align: 'center' },
        // { title: '隔离状态', slot: 'state', width: 100, align: 'center' },
        { title: '密切接触人群(是/否)', slot: 'isfollow', width: 100, align: 'center' },
        { title: '密接相关人', key: 'follow_person', width: 100, align: 'center' },
        { title: '密接等级', slot: 'follow_level', width: 100, align: 'center' },
        { title: '是否确认', slot: 'isaffirm_state', width: 100, align: 'center' },
        { title: '社区确认时间', key: 'affirm_time', width: 100, align: 'center' },
        { title: '转社区时间', key: 'olation_out_time', width: 100, align: 'center' },
        { title: '转运联系人', key: 'transfer_name', width: 100, align: 'center' },
        { title: '转运联系人电话', key: 'transfer_tel', width: 100, align: 'center' },
        { title: '转运车辆车牌号', key: 'transfer_id', width: 100, align: 'center' },
        { title: '转运时间', key: 'transfer_time', width: 100, align: 'center' },
        // { title: '剩余安全观察期日期', key: 'safe_date', width: 150, align: 'center' },
        { title: '来沈前经过地', key: 'arrive_address_type1', width: 120, align: 'center' },
        { title: '来沈前出发地省', key: 'originate_province', width: 130, align: 'center' },
        { title: '来沈前出发地市', key: 'originate_city', width: 130, align: 'center' },
        { title: '住所所属区、县(市)', key: 'area', width: 80, align: 'center' },
        { title: '住所所属街道(乡镇)', key: 'street', width: 80, align: 'center' },
        { title: '住所所属社区(村)', key: 'community', width: 100, align: 'center' },
        { title: '当前所属社区', key: 'company_name', width: 100, align: 'center' },
        { title: '录入时间', key: 'create_time', width: 200, align: 'center' },
        { title: '来沈时间', key: 'arrive_time', width: 200, align: 'center' },
        { title: '具体地址', key: 'address1', minWidth: 250, align: 'center' },
        { title: '操作', align: 'center', width: 160, slot: 'action', fixed: 'right' }
      ],
      columns1: [
        { title: '姓名', key: '姓名', width: 100, align: 'center' },
        { title: '性别', key: '性别', width: 160, align: 'center' },
        { title: '送诊', key: '送诊', width: 80, align: 'center' },
        { title: '送诊地址', key: '送诊地址', width: 80, align: 'center' },
        { title: '发热', key: '发热', width: 80, align: 'center' },
        { title: '证件类型', key: '证件类型', width: 100, align: 'center' },
        { title: '证件号', key: '证件号', width: 120, align: 'center' },
        { title: '街道', key: '街道', width: 100, align: 'center' },
        { title: '联系方式', key: '联系方式', width: 120, align: 'center' },
        { title: '包保人联系方式', key: '包保人联系方式', width: 120, align: 'center' },
        // { title: '人员状态', key: '人员状态', width: 160, align: 'center' },
        // { title: '人员状态备注', key: '人员状态备注', width: 160, align: 'center' },
        { title: '区/县', key: '区/县', width: 120, align: 'center' },
        { title: '社区', key: '社区', width: 80, align: 'center' },
        { title: '具体地址', key: '具体地址', width: 200, align: 'center' },
        { title: '留观', key: '留观', width: 80, align: 'center' },
        { title: '来沈时间', key: '来沈时间', width: 80, align: 'center' },
        { title: '交通方式', key: '交通方式', width: 80, align: 'center' },
        { title: '来沈后活动路径', key: '来沈后活动路径', minWidth: 250, align: 'center' },
        { title: '来沈前经过地类型', key: '来沈前经过地类型', minWidth: 250, align: 'center' },
        { title: '来沈前经过地', key: '来沈前经过地', width: 120, align: 'center' },
        { title: '同行人员', key: '同行人员', width: 120, align: 'center' },
        { title: '接触人员', key: '接触人员', width: 120, align: 'center' },
        { title: '填写时间', key: '填写时间', minWidth: 100, align: 'center' },
        { title: '机构名称', key: '机构名称', minWidth: 100, align: 'center' },
        { title: '机构编号', key: '机构编号', width: 200, align: 'center' },
        { title: '是否删除', key: '是否删除', width: 200, align: 'center' }
      ],
      columns3: [
        { title: '区县', key: 'company_name', align: 'center' },
        { title: '天数', slot: 'day', width: 150, align: 'center' },
        { title: '操作', slot: 'action', width: 100, align: 'center' }
      ],
      fcDataList: []
    }
  },
  computed: {
    companyCode () {
      return this.$store.state.user.severUserInfo.company_code
    }
  },
  watch: {
    $route: function (to, from) {
      console.log(this.$route.query.type, to, '!@!@#@')
      this.type = to.query.type
      this.params.user_type = to.query.user_type
      console.log(this.params, '入参')
      this.selectlist()
    }
  },
  methods: {
    pageAction (page) {
      this.params.pageNo = page
      this.getList()
    },
    selectlist () {
      console.log(this.dateArr)
      this.params.starttime = date0str(this.dateArr[0])
      this.params.endtime = date0str(this.dateArr[1])
      this.params.arrivestarttime = date0str(this.arriveDateArr[0])
      this.params.arriveendtime = date0str(this.arriveDateArr[1])
      if (saveparams.info.jtoc) {
        this.params.pageNo = saveparams.info.jtoc.pageNo
      } else {
        this.params.pageNo = 1
      }
      this.params.type = this.type
      if (this.params.area3 === '' && this.params.area2 === '') {
        this.params.company_code = this.params.area1
      } else if (this.params.area2 !== '' && this.params.area3 === '') {
        this.params.company_code = this.params.area2
      } else if (this.params.area1 === '' && this.params.area2 === '' && this.params.area3 === '') {
        this.params.company_code = ''
      } else if (this.params.area1 !== '' && this.params.area2 !== '' && this.params.area3 !== '') {
        this.params.company_code = this.params.area3
      }
      if (this.params.province2 === '全部') {
        this.params.originate_province = ''
      } else {
        this.params.originate_province = this.params.province2
      }
      if (this.params.city2 === '全部') {
        this.params.originate_city = ''
      } else {
        this.params.originate_city = this.params.city2
      }
      this.getList()
    },
    setsuperviseday () {
      findSupervisedayList(this.params).then(res => {
        if (res.data.errcode === 0) {
          this.supervisedayinfo.data = res.data.data
        } else {
          this.loadData = true
          this.$Notice.error({
            title: '查询列表信息失败',
            desc: res.data.errmsg
          })
        }
      })
      this.supervisedayinfo.isshow = true
    },
    updatesupervisedayinfo (param) {
      saveSuperviseday(param).then(res => {
        if (res.data.data) {
          this.modalInfo.show = false
          this.$Notice.success({ title: '保存成功' })
        } else {
          this.$Notice.error({ title: '保存失败' })
        }
      })
    },
    getList () {
      // ---调用接口可以打开
      if (this.$route.query.type === '1') {
        this.params.hot = '1'
      } else if (this.$route.query.type === '2') {
        this.params.hot = ''
      } else {
        this.params.hot = ''
      }
      if (this.params.supervise_start !== '1') {
        this.params.is_transfer = ''
      }
      if (this.params.isfollow !== '1') {
        this.params.follow_person = ''
        this.params.follow_level = ''
      }
      if (this.params.nucleic_acid !== '1') {
        this.params.detection_1_result = ''
        this.params.detection_2_result = ''
      }
      let aa = ''
      for (let i = 0; i < this.params.supervise_startlista.length; i++) {
        aa += this.params.supervise_startlista[i] + ','
      }
      aa = (aa.substring(aa.length - 1) === ',') ? aa.substring(0, aa.length - 1) : aa
      console.log(aa, '====supervise_startliststr')
      this.params.supervise_startlist = aa
      this.params.affirm_statenotnull = '1'
      this.params.affirm_state = '0' // 2021年01月08日只查未确认的
      this.fcDataList = []
      this.loadData = true
      userUpList(this.params).then(res => {
        let result = res.data
        let that = this
        if (res.data.errcode === 0 || res.data.errcode === 1001) {
          this.fcDataList = res.data.data.results
          this.fcDataList.forEach(function (temp1, index) {
            for (var i = 0; i < that.dictList.length; i++) {
              if (temp1.arrive_address_type === that.dictList[i].value) {
                temp1.arrive_address_type1 = that.dictList[i].label
              }
            }
            for (var j = 0; j < that.superviseDictList.length; j++) {
              if (temp1.supervise_start === that.superviseDictList[j].value) {
                temp1.supervise_start1 = that.superviseDictList[j].label
              }
            }
            let tempCardno = temp1.card_no
            if (tempCardno) {
              temp1.card_no1 = `${tempCardno.substring(0, 10)}******${tempCardno.substring(tempCardno.length - 2)}`
            }
            // let tempMobile = temp1.tel
            // if (tempMobile) {
            //  if (tempMobile.length === 11) {
            //    temp1.tel1 = `${tempMobile.substring(0, 3)}****${tempMobile.substring(tempMobile.length - 4)}`
            //  } else {
            //    temp1.tel1 = `${tempMobile.substring(0, 3)}****`
            //  }
            // }
            let tempAddress = temp1.address
            if (tempAddress) {
              temp1.address1 = that.hideCode(tempAddress, 4, 2)
            }
            let tempBirthday = temp1.birthday
            if (tempBirthday) {
              this.datalist[i].birthday = `${tempBirthday.substring(0, 4)}****`
            }
          })
          this.loadData = false
          this.countData.fcnum = res.data.data.totalRecord
          this.params = {
            pageNo: result.data.pageNo,
            pageSize: result.data.pageSize,
            totalPage: result.data.totalPage,
            totalRecord: result.data.totalRecord,
            // area: this.params.area,
            street: this.params.street,
            community: this.params.community,
            area1: this.params.area1,
            area2: this.params.area2,
            area3: this.params.area3,
            card_no: this.params.card_no,
            name: this.params.name,
            tel: this.params.tel,
            arrive_address_type: this.params.arrive_address_type,
            hot: this.params.hot,
            isfollow: this.params.isfollow,
            illness_state: this.params.illness_state,
            isout_sheny: this.params.isout_sheny,
            user_type: this.params.user_type,
            endtime: this.params.endtime,
            starttime: this.params.starttime,
            originate_province: this.params.originate_province,
            originate_city: this.params.originate_city,
            province2: this.params.province2,
            city2: this.params.city2,
            company_code: this.params.company_code,
            // inout_state: this.params.inout_state,
            supervise_start: this.params.supervise_start,
            supervise_timeout: this.params.supervise_timeout,
            arrivestarttime: this.params.arrivestarttime,
            arriveendtime: this.params.arriveendtime,
            state: this.params.state,
            id: this.params.id,
            nucleic_acid: this.params.nucleic_acid,
            isolation: this.params.isolation,
            follow_person: this.params.follow_person,
            follow_level: this.params.follow_level,
            is_transfer: this.params.is_transfer,
            detection_1_result: this.params.detection_1_result,
            detection_2_result: this.params.detection_2_result,
            risk_groups: this.params.risk_groups,
            supervise_startlist: aa,
            supervise_startlista: this.params.supervise_startlista,
            affirm_statenotnull: '1',
            // affirm_state: this.params.affirm_state 2021年01月08日只查未确认的
            affirm_state: 0
          }
          saveparams.info.jtoc = this.params
        } else {
          this.loadData = true
          this.$Notice.error({
            title: '查询列表信息失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    getAllList () {
      findOutAllList({}).then(res => {
        if (res.data.errcode === 0) {
          console.log(res.data.data.id, 'idididiid')
          this.fcAllDataStr = res.data.data.id
          this.loading = false
          window.open(this.fcAllDataStr)
          // this.$refs.table.exportCsv({
          //  filename: '疫情监控人员信息',
          //  columns: this.columns1,
          //  // columns: this.columns1.filter((col, index) => index < 20),
          //  data: this.fcAllDataList.map(item => {
          //    item.来沈时间 = '="' + item.来沈时间 + '"'
          //    item.填写时间 = '="' + item.填写时间 + '"'
          //    // if (item.hot === '1') {
          //    //  item.hot = '发热'
          //    // } else if (item.hot === '0') {
          //    //  item.hot = '未发热'
          //    // }
          //    // if (item.referral === '0') {
          //    //  item.referral = '未送诊'
          //    // } else if (item.referral === '1') {
          //    //  item.referral = '已送诊'
          //    // }
          //    // if (item.isfollow === '1') {
          //    //  item.isfollow = '是'
          //    // } else if (item.isfollow === '0') {
          //    //  item.isfollow = '否'
          //    // }
          //    // if (item.arrive_address_type === '1') {
          //    //  item.arrive_address_type = '湖北武汉'
          //    // } else if (item.arrive_address_type === '2') {
          //    //  item.arrive_address_type = '湖北其他城市'
          //    // } else if (item.arrive_address_type === '4') {
          //    //  item.arrive_address_type = '武汉海鲜市场'
          //    // } else if (item.arrive_address_type === '3') {
          //    //  item.arrive_address_type = '其他省市'
          //    // }
          //    return item
          //  }),
          //  original: false
          // })
          console.log('123123')
        } else {
          this.$Notice.error({
            title: '查询全部人员信息列表失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    findDictList (value) {
      // let that = this
      var dic = { 'label': '全部', 'value': '' }
      getDictList({ type: 'arrive_address_type', pageSize: 30, pageNo: 1 }).then(res => {
        if (res.data.errcode === 0) {
          let obj = {
            value: '',
            label: '全部'
          }
          let obj1 = {
            value: '999',
            label: '空'
          }
          let obj2 = {
            value: '3',
            label: '其他'
          }
          this.dictList = res.data.data.results
          this.dictList.splice(0, 0, obj)
          this.dictList.push(obj1)
          this.dictList.push(obj2)
          // setTimeout(function () {
          //   that.selectlist()
          // }, 500)
        } else {
          this.$Notice.error({ title: '查询失败' })
        }
      })
      getDictList({ type: 'supervise_start' }).then(res => {
        if (res.data.errcode === 0) {
          this.superviseDictList = res.data.data.results
          this.superviseDictList.unshift(dic)
          // setTimeout(function () {
          //   that.selectlist()
          // }, 500)
        } else {
          this.$Notice.error({ title: '查询失败' })
        }
      })
      getDictList({ type: 'follow_person' }).then(res => {
        if (res.data.errcode === 0) {
          this.followPersonList = res.data.data.results
          this.followPersonList.unshift(dic)
          // setTimeout(function () {
          //   that.selectlist()
          // }, 500)
        } else {
          this.$Notice.error({ title: '查询失败' })
        }
      })
      getDictList({ type: 'is_transfer' }).then(res => {
        if (res.data.errcode === 0) {
          this.isTransferList = res.data.data.results
          this.isTransferList.unshift(dic)
          // setTimeout(function () {
          //   that.selectlist()
          // }, 500)
        } else {
          this.$Notice.error({ title: '查询失败' })
        }
      })
    },
    chaneProv (index) {
      let temparea = this.params['province' + index]
      if (!temparea) {
        return
      }
      let templist = this.inoutCity.provinceList
      let tempdata = {}
      for (let i = 0; i < templist.length; i++) {
        if (temparea === templist[i].name) {
          tempdata = templist[i]
          break
        }
      }
      this.getCity(tempdata.code, 'city' + index, false)
    },
    getCity (code, listname, flag) {
      getCityList({ code: code }).then(res => {
        if (res.data.errcode === 0) {
          this.inoutCity[listname] = res.data.data
          let obj = {
            code: '-',
            name: '全部'
          }
          this.inoutCity[listname].splice(0, 0, obj)
          if (flag) {
            if (this.formInfo.province1) {
              this.chaneProv(1)
            }
            if (this.formInfo.province2) {
              this.chaneProv(2)
            }
          }
        } else {
          this.$Notice.error({ title: '查询失败' })
        }
      })
    },
    deleteRow (row) {
      this.$Modal.confirm({
        title: '确认删除该人员信息吗？',
        content: '删除后不可恢复，请确认后再操作！',
        onOk: () => {
          delbyid({ id: row.id }).then(res => {
            if (res.data.errcode === 0) {
              this.getList()
            } else {
              this.$Notice.error({
                title: '删除人员信息失败',
                desc: res.data.errmsg
              })
            }
          })
        }
      })
    },
    moveOut (row) {
      this.modal3 = true
      this.id = row.id
    },
    addPerson (what) {
      this.$router.push({ path: '/yi-qing/add-buttons' })
    },
    census () {
      this.$router.push({ path: '/yi-qing/statistics' })
    },
    showdetail (row, what) {
      this.$router.push({
        path: '/yi-qing/add',
        query: {
          id: row.id,
          what: what,
          arrive_address_type: row.arrive_address_type,
          user_type: this.params.user_type
        }
      })
    },
    temperature (row) {
      this.$router.push({ path: '/yi-qing/fever-list', query: { id: row.id } })
    },
    fever (row) {
      this.modal1 = true
      this.hot = row.hot
      this.id = row.id
    },
    Referral (row) {
      this.modal2 = true
      this.referral = row.referral
      this.referral_address = row.referral_address
      this.id = row.id
    },
    leave (row) {
      this.modal4 = true
      this.modalInfo1.id = row.id
      this.modalInfo1.isout_sheny = row.isout_sheny
      this.modalInfo1.isout_sheny_remark = row.isout_sheny_remark
    },
    ok1 () {
      updateuserinfo({ id: this.id, referral: this.referral, referral_address: this.referral_address }).then(res => {
        if (res.data.errcode === 0) {
          this.$Notice.success({
            title: '',
            desc: '更改送诊信息成功'
          })
          this.modal1 = false
          this.getList()
        } else {
          this.$Notice.error({
            title: '更改送诊状态失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    ok2 () {
      updateuserinfo(this.modalInfo1).then(res => {
        if (res.data.errcode === 0) {
          this.$Notice.success({
            title: '',
            desc: '更改离沈信息成功'
          })
          this.modal4 = false
          this.getList()
        } else {
          this.$Notice.error({
            title: '更改离沈状态失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    ok () {
      updateuserinfo({ id: this.id, hot: this.hot }).then(res => {
        if (res.data.errcode === 0) {
          this.$Notice.success({
            title: '',
            desc: '更改发热状态成功'
          })
          this.modal1 = false
          this.getList()
        } else {
          this.$Notice.error({
            title: '更改发热状态失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    saveCompany () {
      console.log(JSON.parse(this.modalStr))
      this.modalInfo = {
        user_id: this.id,
        in_company: JSON.parse(this.modalStr).code,
        out_company_name: this.$store.state.user.severUserInfo.company_name,
        in_company_name: JSON.parse(this.modalStr).sq_name
      }
      createOutApplu(this.modalInfo).then(res => {
        if (res.data.errcode === 0) {
          this.$Notice.success({
            title: '',
            desc: '迁出人员信息成功'
          })
          this.modal1 = false
          this.getList()
        } else {
          this.$Notice.error({
            title: '迁出人员信息失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    cancel () {
      this.modal1 = false
      this.modal2 = false
      this.modal3 = false
      this.modal4 = false
    },
    perChange (index) {
      let temparea = this.params['area' + index]
      if (!temparea) {
        return
      }
      let templist = this.addressInfo['list' + index]
      let tempdata = {}
      for (let i = 0; i < templist.length; i++) {
        if (temparea === templist[i].company_code) {
          tempdata = templist[i]
        }
      }
      this.getDownAddress(tempdata.id, index + 1)
    },
    // 下拉搜索框的级联查询
    getDownAddress (pid, index) {
      let param = {
        pid: pid,
        pageNo: 1,
        pageSize: 200
      }
      grid_downlist(param).then(res => {
        if (res.data.data) {
          this.addressInfo['list' + index] = res.data.data.results
          let obj = {
            id: '',
            level: '',
            mapjson: '',
            path: '',
            pid: 0,
            title: '全部',
            company_code: ''
          }
          this.addressInfo['list' + index].unshift(obj)
          this.perChange(index)
        } else {
          this.$Notice.error({ title: '查看失败', desc: '查询地址信息失败' })
        }
      })
    },
    getCompanyList () {
      getUserByMZList({}).then(res => {
        if (res.data.errcode === 0) {
          this.company_list = res.data.data
        } else {
          this.$Notice.error({
            title: '获取社区列表失败',
            desc: res.data.errmsg
          })
        }
      })
    },
    uploadImgAll (row, what) {
      this.row = row
      this.$refs.imgService.modelAction()
    },
    pageSizeChange (e) {
      this.params.pageSize = e
      this.selectlist(this.params.pageNo)
    },
    chuanSongAction () {
      this.$refs.turnPeopleModel.modelAction()
    },
    exportData (type) {
      if (this.fcAllDataStr === '') { // 没有数据需加载接口
        this.loading = true
        this.getAllList()
      } else {
        this.loading = false
        window.open(this.fcAllDataStr)
        // this.$refs.table.exportCsv({
        //  filename: '疫情监控人员信息',
        //  columns: this.columns1,
        //  data: this.fcAllDataList.map(item => {
        //    // item.来沈时间 = '="' + item.来沈时间 + '"'
        //    // item.填写时间 = '="' + item.填写时间 + '"'
        //    return item
        //  }),
        //  original: false
        // })
      }
    },
    importExcel () {

    },
    hideCode (str, frontLen, endLen) {
      var len = str.length - frontLen - endLen
      var xing = ''
      for (var i = 0; i < len; i++) {
        xing += '*'
      }
      return str.substring(0, frontLen) + xing + str.substring(str.length - endLen)
    }
  },
  mounted () {
    let that = this
    if (saveparams.info.jtoc !== undefined) {
      this.params = saveparams.info.jtoc
    }
    this.params.user_type = this.$route.query.user_type
    console.log(this.$route.query.user_type, 'dfsfafsd')
    this.getDownAddress(0, 1)
    this.getCity(null, 'provinceList', false)
    this.findDictList()
    setTimeout(function () {
      that.selectlist()
    }, 500)
    // this.getCompanyList()
  }
}
</script>

<style scoped>
    .page_style {
        margin: 20px 5px;
    }

    .input-frame {
        width: 120px;
        margin-right: 10px;
    }

    .house-list > .group {
        background: white;
        padding: 10px;
        margin-top: 10px;
    }

    .house-list > .group > .item {
        border-bottom: 1px solid #f5f5f5;
        padding: 10px 0;
    }

    .house-list > .group > .item .top {
        display: flex;
        justify-content: space-between;
        margin-bottom: 5px;
    }

    .house-list > .group > .item .title {
        font-size: 14px;
        color: #333333;
    }

    .house-list > .group > .item .address {
        font-size: 12px;
        color: gray;
        display: flex;
        align-items: center;
    }

    .house-list > .group > .item .detail {
        font-size: 12px;
        color: dodgerblue;
    }

    .opt-area-02 {
        display: flex;
        align-items: center;
        flex-direction: column;
        border: 1px solid #abdcff;
        background-color: #f0faff;
        padding: 8px 16px 8px 16px;
        border-radius: 4px;
        margin-bottom: 10px;
    }

    .opt-area-02 .right-con55 {
        width: 100%;
        margin-top: 5px;
        display: flex;
    }

    .opt-area-02 .left-con {
        font-size: 14px;
        width: 100%;
    }

    .opt-area-02 .left-con span {
        font-weight: bold;
    }

    .opt-area-02 .right-con55 input {
        margin-right: 10px;
    }

    .opt-area-02 .right-con55 .input-frame {
        width: 200px;
        margin-right: 10px;
    }

    .table-action-btn {
        margin-right: 3px;
    }

    .container >>> .ivu-btn-small {
        height: 24px;
        padding: 0 5px;
        font-size: 12px;
        border-radius: 3px;
    }

    .btn-action {
        margin-bottom: 10px;
    }

    .mp10 {
        margin-right: 10px;
    }
    .title-style {
      color: red;
    }
    .mb20 {
      margin-bottom: 20px;
    }
    .ivu-table-row {
      height: 57px;
    }
    .demo-spin-icon-load{
      animation: ani-demo-spin 1s linear infinite;
    }
    @keyframes ani-demo-spin {
      from { transform: rotate(0deg);}
      50%  { transform: rotate(180deg);}
      to   { transform: rotate(360deg);}
    }
    .demo-spin-col{
      height: 100px;
      position: relative;
      /*border: 1px solid #eee;*/
    }
</style>
